<script setup lang="ts">

import {useRouter} from "vue-router";
import {onMounted, ref} from "vue";
import {getCurrentUser} from "../states/user.ts";



const router = useRouter();

const toEdit = (editKey: string, editName: string, currentValue: string) => {
  router.push({
    path: '/user/edit',
    query: {
      editKey,
      editName,
      currentValue,
    }
  })
}

// const user={
//   id: 1,
//   username: '我自己',
//   userAccount: 'douYou',
//   avatarUrl: '',
//   gender: '男',
//   phone: '12345678',
//   email: '12345@qq.com',
//   planetCode:'1234',
//   createTime: new Date(),
// }

const user = ref({});


onMounted(async () => {
  user.value = await getCurrentUser();
})

</script>
<template v-if="user">
  <van-cell title="当前用户" :value="user?.username" />
  <van-cell title="修改信息" is-link to="/user/update" />
  <van-cell title="我创建的队伍" is-link to="/user/team/create" />
  <van-cell title="我加入的队伍" is-link to="/user/team/join" />

</template>

<style scoped>

</style>